﻿using System;
using System.ComponentModel;
using SQLite;

namespace Cashbook.Models
{
    [Table("Statements")]
	public class Statement : INotifyPropertyChanged
	{
		private int _id;
		[PrimaryKey, AutoIncrement]
		public int Id
		{
			get
			{
				return _id;
			}
			set
			{
				this._id = value;
				OnPropertyChanged(nameof(Id));
			}
		}

		private string _title;
		[NotNull]
		[MaxLength(50)]
		public string Title
		{
			get
			{
				return _title;
			}
			set
			{
				this._title = value;
				OnPropertyChanged(nameof(Title));
			}
		}
        	


		private int _amount;
		[NotNull]
		public int Amount
		{
			get
			{
				return _amount;
			}
			set
			{
				this._amount = value;
				OnPropertyChanged(nameof(Amount));
			}
		}

		private int _billId;
		[NotNull]
		public int BillId
		{
			get
			{
				return _billId;
			}
			set
			{
				this._billId = value;
				OnPropertyChanged(nameof(BillId));
			}
		}


		private DateTime _addedDate;
		[NotNull]
		public DateTime AddedDate
		{
			get
			{
				return _addedDate;
			}
			set
			{
				this._addedDate = value;
				OnPropertyChanged(nameof(AddedDate));
			}
		}



		public event PropertyChangedEventHandler PropertyChanged;
		private void OnPropertyChanged(string propertyName)
		{
			this.PropertyChanged?.Invoke(this,
			  new PropertyChangedEventArgs(propertyName));
		}

	}
}
